package com.inspur.ourhis_afterend.Controller;

import com.inspur.ourhis_afterend.Entity.Dept;
import com.inspur.ourhis_afterend.Service.DrugStoreService;
import com.inspur.ourhis_afterend.Tools.PageAction;
import com.inspur.ourhis_afterend.Tools.Result;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/drugStore")
public class DrugStoreController {

    @Autowired
    DrugStoreService drugStoreService;

    @ApiOperation("查询全部入库信息")
    @ApiParam("传入分页")
    @PostMapping("/findAll")
    public Result findAll(@RequestBody PageAction pageAction) {
        try {
            return Result.success(drugStoreService.findAll(pageAction));
        } catch (Exception e) {
            e.printStackTrace();
            return Result.failure(e.toString());
        }
    }

    // @ApiParam("传入查询条件")
    // @ApiOperation("科室查询")
    // @PostMapping("/search")
    // public Result search(@Param("departId") String departId,
    //                      @Param("name") String name) {
    //     System.out.println(departId);
    //     System.out.println(name);
    //     try {
    //         System.out.println(departId);
    //         return Result.success(deptService.search(departId, name));
    //     } catch (Exception e) {
    //         e.printStackTrace();
    //         return     Result.failure(e.toString());
    //     }
    // }

    // @ApiOperation("添加科室")
    // @PostMapping("/add")
    // @ApiParam(value = "传入一个科室对象")
    // public Result add(@RequestBody Dept dept) {
    //     System.out.println(dept);
    //     try {
    //         deptService.add(dept);
    //         return Result.success("添加成功");
    //     } catch (Exception e) {
    //         e.printStackTrace();
    //         return Result.failure(e.toString());
    //     }
    // }
    

}
